-
Notifications
You must be signed in to change notification settings - Fork 874
[V4] Update existing service tests to use async operations #4178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V4] Update existing service tests to use async operations #4178
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR modernizes integration tests by converting synchronous operations to async/await patterns across multiple AWS service test suites. The changes align with the repository's goal of adopting modern .NET async patterns while also removing tests that don't validate custom hand-written code or that require special credentials (IAM users) not available in the CI/CD pipeline.
Key Changes:
- Converted test methods from synchronous to async (
void→async Task) - Updated all service client calls to use
Asyncmethods withawait - Replaced
Thread.Sleep()withTask.Delay() - Removed tests marked with
[TestCategory("RequiresIAMUser")]that aren't run in the build system - Deleted entire test projects for services where tests didn't validate custom code (RDS, Lambda, KMS, IAM, ELB, etc.)
Reviewed changes
Copilot reviewed 53 out of 53 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| WAF.cs | Converted to async, changed yield return pattern to list collection for async compatibility |
| SNS.cs | Converted to async, improved cleanup with null-conditional operators, removed ignored subscription test |
| SQS.cs | Converted to async, simplified queue operations, improved code formatting |
| S3Control/PublicAccessBlockTests.cs | Converted to async with proper test initialization |
| S3/KMSTests.cs | Minor change to use KMS client with region endpoint configuration |
| Route53.cs | Converted to async, removed flaky delegation set test, improved VPC test cleanup |
| Polly tests | Converted to async, removed test requiring IAM user credentials |
| IotData tests | Converted to async, improved cleanup logic |
| GameLift tests | Converted to async, changed yield return to list collection |
| EC2 tests | Converted to async, removed empty test file, improved security group tests |
| DynamoDBStreams tests | Converted to async with minor config improvements |
| CloudWatch tests | Removed extensive alarm tests, kept compression test |
| SecurityToken, RDS, Lambda, KMS, IAM, ELB projects | Deleted entirely along with config files |
| CognitoSync | Moved cache test to unit tests, deleted integration test project |
| ECS/CredentialsTests | Removed session credentials test |
| [ClassCleanup] | ||
| public static void ClassCleanup() | ||
| { | ||
| BaseClean(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was baseclean not doing anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this was an integration test that was validating properties via reflection... https://github.com/aws/aws-sdk-net/blob/main/sdk/test/Services/CognitoSync/IntegrationTests/CognitoSync.cs
Since I moved it to an unit test instead there's no need for a TestBase anymore, but for reference it just disposes the service client:
aws-sdk-net/sdk/test/IntegrationTests/Tests/TestBase.cs
Lines 34 to 41 in d7d3513
| public static void BaseClean() | |
| { | |
| if (client != null) | |
| { | |
| client.Dispose(); | |
| client = null; | |
| } | |
| } |
| { | ||
| var keyId = KeyManagementService.Client.CreateKey(new Amazon.KeyManagementService.Model.CreateKeyRequest | ||
| var kms = new AmazonKeyManagementServiceClient(Client.Config.RegionEndpoint); | ||
| var keyId = kms.CreateKey(new Amazon.KeyManagementService.Model.CreateKeyRequest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be using async version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So do not ask me why, but this is a test in the S3 project that was using the client from KMS... I plan to make the same update I made here (sync -> async) for S3 and DDB in their own PRs since those are the largest services (and with the highest number of tests).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
5a8c822
into
dspin/test-async-refactoring
Follow up for #4177, this PR updates the tests for services with hand-written code to use the
Asyncoperations. Most of the changes here are similar toClient.GetRestApi->await Client.GetRestApiAsyncbut some important things to call out:ValidateTemplateinstead (with aaws-vs-toolkit.s3.amazonaws.comURL...)Testing
Dry-run:
DRY_RUN-f2020ce8-4c7b-4f82-80aa-24b63d923a66License